package com.ds.robot.assistant.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * 作用：
 *
 * @author WeiShaoying
 *
 */
@Getter
public enum QxUserEnum {

    WSY("weishaoying_pr", "魏韶颖"),
    ;

    QxUserEnum(String id, String name) {
        this.id = id;
        this.name = name;
    }

    private final String id;
    private final String name;


    /**
     * 通过名称查询ID
     *
     * @param name
     * @return
     */
    public static String getIdByName(String name) {
        return Arrays.stream(QxUserEnum.values()).filter(item -> item.getName().equals(name)).findFirst().map(QxUserEnum::getId).orElse("");
    }

    public static void main(String[] args) {
        System.out.println(getIdByName("邓中建"));
    }
}
